package com.vueapi.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.vueapi.domain.HjExceptionLog;
import com.vueapi.domain.HjOperationLog;
import com.vueapi.service.HjExceptionLogService;
import com.vueapi.mapper.HjExceptionLogMapper;
import com.vueapi.utils.ParseUtils;
import com.vueapi.utils.ResultUtils;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* @author 15442
* @description 针对表【hj_exception_log】的数据库操作Service实现
* @createDate 2022-09-20 14:36:03
*/
@Service
public class HjExceptionLogServiceImpl extends ServiceImpl<HjExceptionLogMapper, HjExceptionLog>
    implements HjExceptionLogService{

    @Override
    public ResultUtils listPage(Integer pageNum, Integer pageSize, String message) {
        LambdaQueryWrapper<HjExceptionLog> cw = new LambdaQueryWrapper<>();
        cw.like(!message.equals(""),HjExceptionLog::getMessage,message);
        cw.orderByDesc(HjExceptionLog::getCreateTime);

        Page<HjExceptionLog> operationLogPage = this.page(new Page<>(pageNum, pageSize), cw);

        return ResultUtils.success(operationLogPage);
    }

    @Override
    public Boolean exceptionDeleteByIds(String ids) {
        List<Integer> operationIds = ParseUtils.intArrayToList(ParseUtils.stringToIntArray(ids));
        return removeByIds(operationIds);
    }
}




